package team.nmsg.ge.system.init.shiro;

import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.SubjectContext;
import org.apache.shiro.web.mgt.DefaultWebSubjectFactory;
import org.apache.shiro.web.subject.WebSubjectContext;

/**
 * 主要是设置不让shiro生成session
 * @author Declan
 */
public class StatelessDefaultSubjectFactory extends DefaultWebSubjectFactory {
	
	public Subject createSubject(SubjectContext context) {
		// 关闭session的创建
		context.setSessionCreationEnabled(false);
//		WebSubjectContext wsc = (WebSubjectContext) context;
//		System.out.println(wsc.isSessionCreationEnabled()); //查看是否创建session
		return super.createSubject(context);
	}
	
}